-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect wallet with ledger live app #36
Conversation
To connect accounts with the dApp let's use the `useRequestAccount` hook from the WALLET API for this. Also, we should store the account data in context to have global access to it.
We should correctly display user balances. Let us use the formatting functions and display the balance correctly by region.
- Ad comment about tooltip - Add different style when an account is not defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass, left some comments. Overall looks good.
Just wonder how we can be more abstract in terms of requesting a user to connect to an account 🤔. Would be great if we could easily switch from Ledger Live to a standalone dapp. But this is probably something that should be solved in another PR.
Co-authored-by: Rafał Czajkowski <[email protected]>
This function is based on the solution used by the Taho extension. More info: https://github.com/tahowallet/extension/blob/main/background/lib/fixed-point.ts#L216-L239
Currently, we don't distinguish the Ledger Live app and the standalone dapp. However, in the future, I see it as something like this: one hook or service returning to us a set of the right tools depending on which application it is. At the moment I have created custom hooks for the ledger live app but I think adapting this for the standalone app should be done with another PR. |
- Remove a dir for providers and move it to contexts dir. - Create a wrapper for context. - Use a more abstract context name - `WalletContext` - Small improvements
<Text as="b"> | ||
{!btcAccount || btcAccount?.balance.isZero() | ||
? "0.00" | ||
: formatSatoshiAmount(btcAccount.balance.toString())} | ||
</Text> | ||
<Text>{BITCOIN.symbol}</Text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think would be great if we could create a reusable component where we just pass value and currency and all this stuff will be handled in a component. Otherwise, we always duplicate logic when displaying the amount. Ofc we can address it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Let's do it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix it in #56.
|
||
export default function Navbar() { | ||
return ( | ||
<Box p={4} display="flex" justifyContent="end"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just flagging, we can use Flex
component from Chakra <Flex p={4} justify="end">
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the next PR I use here HStack
. I'm not quite sure which is better. But let's move the discussion there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds the possibility to request access to a user’s account in the ledger live app. To do this, we need to extend the permissions in the manifest file -
account.request
. When the user has selected an account, let's save it in a special context for global access.What has been done
VITE_USE_TESTNET
UI